<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //键值一一对应，对象
    let person = {
      uname: '张三',
      age: 12
    }
    let { uname, age } = person
    console.log(uname, age)
    //提取值
    let { uname: nameValue, age: ageValue } = person
    console.log(nameValue, ageValue);
    //嵌套
    let { id: [num, { sex: gender }] } = { id: [123456, { sex: '男' }] }
    console.log(num, gender);
    console.log(gender);
    console.log(typeof num);
    console.log(typeof gender);
    //剩余
    let { a, ...agrs } = { a: 1, b: 2, c: 3, d: 4 }
    console.log(agrs);
    //解构默认值
    let { m = 1, n = m } = { m: 3 }
    console.log(m, n);
  </script>
</body>

</html>